<template>
  <div>
    <div class="simple-show-list" v-for="(item, i) in bookList" :key='item.id'>
      <router-link :to="'/index/bookDetail?id='+item.bookId" :target="global.goBookDetailType">
        <div class="simple-show-left">
          <div class="simple-show-num">{{i+1}}</div>
        </div>
        <div class="simple-show-mid">
          <div class="simple-show-title">[{{item.catName}}]<span>{{item.bookName}}</span></div>
          <div class="simple-show-index">
            <span class="simple-show-index-name">[{{item.indexCount}}] {{item.lastIndexName}}</span>
            <span class="simple-show-index-time">{{item.lastIndexUpdateTime}}</span>
          </div>
        </div>
      </router-link>
      <div class="simple-show-right" @click="removeItem(item)">
        <div class="simple-show-right-cont">移除</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props:{
    bookList:Array,
  },
  methods:{
    removeItem(item){
      this.$confirm('是否确定移除['+item.bookName+']？', '提示', {
        customClass:"el-message-box_custom",
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$emit('removeitem', item.bookId);
      }).catch(() => {
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.simple-show-list {
  //上下居中
  margin: 5px 0;
  height: 40px;
  border: 1px solid #efefef;
  border-width: 0 0 1px 0;
  .simple-show-left{
    display: inline-block;
    width: 23px;
    height: 100%;
    vertical-align: middle;
    .simple-show-num {
      text-align: center;
      display: inline-block;
      width: 18px;
      height: 18px;
      color: #fff;
      background-color: #999999;
      margin-right: 7px;
      font-size: 13px;
    }
  }

  .simple-show-mid {
    color: #333;
    display: inline-block;
    width: calc(100% - 63px);
    height: 100%;
    .simple-show-title {
      height: 50%;
      span {
        padding-left: 5px;
      }
    }

    .simple-show-index {
      position: relative;
      height: 50%;
      padding-left: 10px;
      font-size: 12px;
      .simple-show-index-name {
        display: inline-block;
        width: calc(100% - 95px);
        //超出隐藏
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .simple-show-index-time{
        position: absolute;
        right: 0;
        color: #666;
      }
    }

    // .simple-show-time {
    //   text-align: right;
    //   font-size: 12px;
    //   color: #666;
    //   padding-right: 20px;
    // }
  }

  .simple-show-right{
    display: inline-block;
    width: 40px;
    height: 100%;
    vertical-align: top;
    text-align: right;
    .simple-show-right-cont{
      line-height: 40px;
    }
  }
}
</style>